package lab03.test04;

import java.io.*;

public class Test04 {
    public static void main(String[] args) {
        String s = "";
        File myfile = new File("F:\\source");
        myfile.mkdirs();
        myfile = new File("F:\\target");
        myfile.mkdirs();

        FileInputStream fileInputStream = null;
        try {
            fileInputStream = new FileInputStream("F:\\source\\GALA - 追梦赤子心.mp3");
            byte[] data = new byte[fileInputStream.available()];
            fileInputStream.read(data);
            s = new String(data);
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            try {
                fileInputStream.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }

        FileOutputStream fileOutputStream = null;
        try {
            fileOutputStream = new FileOutputStream("F:\\target\\吴亦凡-- 6.mp3");
            fileOutputStream.write(new String(s).getBytes());
            System.out.println("复制成功！");
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            try {
                fileOutputStream.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
}

